<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增商户码商关系')" />
    <th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-tServerMerInfo-add">
            <div class="form-group">
                <label class="col-sm-3 control-label is-required">码商名称：</label>
                <div class="col-sm-8">
                    <select name="userId" id="userId" class="form-control"
                            th:with="type=${@sysUser.selectUserListByType('ms')}">
                        <option value="">所有</option>
                        <option th:each="dict : ${type}" th:text="${dict.userName}"
                                th:value="${dict.userId}"></option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label is-required">商户编码：</label>
                <div class="col-sm-8">
                    <select name="shId" id="shId" class="form-control select2-multiple" multiple
                            th:with="type=${@sysUser.selectUserListByType('sh')}">
                        <option th:each="dict : ${type}" th:text="${dict.userName}"
                                th:value="${dict.userId}"></option>
                    </select>
                </div>
            </div>

        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: select2-js" />
    <script th:inline="javascript">
        var prefix = ctx + "business/tServerMerInfo"
        $("#form-tServerMerInfo-add").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                var data = $("#form-tServerMerInfo-add").serializeArray();
                var shIds = $.form.selectSelects("shId");
                data.push({"name": "shIds", "value": shIds});
                $.operate.save(prefix + "/add",data);
            }
        }
    </script>
</body>
</html>